var create_fib = function() {
    /*
        JavaScript 1.7 introduces the 'yield' keyword, just like in Python.
        Using a closure here since ECMAScript 3 does not support 'yield'.
     */
    var x = 1;
    var y = 0;

    function fib() {
        var toReturn = y;
        var next = x + y;
        y = x;
        x = next;

        return toReturn;
    };

    return fib;
};

var fib = create_fib();
var parts = [];
for (var x=0; x < (parseInt(arguments[0]) + 1); x+=1) {
    parts.push(fib());
}
parts.push("...");
print(parts.join(" "));
